package cn.zust.ly.EyExample.Ey09;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for (int i = 10000; i < 100000; i++) {
			if (isGodeNum(i, n)) {
				System.out.println(i);
			}
		}
		for (int i = 100000; i < 1000000; i++) {
			if (isGodeNum2(i, n)) {
				System.out.println(i);
			}
		}
	}
	static boolean isGodeNum(int x, int n) {
		int a = x/10000;
		int b = (x%10000)/1000;
		int c = (x%1000)/100;
		int d = (x%100)/10;
		int e = x%10;
		return a==e && b==d && 2*(a+b)+c==n;
	}
	static boolean isGodeNum2(int x, int n) {
		int a = x/100000;
		int b = (x%100000)/10000;
		int c = (x%10000)/1000;
		int d = (x%1000)/100;
		int e = (x%100)/10;
		int f = x%10;
		return a==f && b==e && d==c && 2*(a+b+c)==n;
	}
}
